﻿//获取cookie
function getCookie(name) {
    var cklist = document.cookie ? document.cookie.split('; ') : [];
    for (var i = 0; i < cklist.length; i++) {
        var keylist = cklist[i].split("=");
        if (keylist[0] == name) {
            return keylist[1];
        }
    }
    return "";
}

//创建cookie
//Cookie名称
//Cookie值
//过期时间
function setCookie(name, value, expDays) {
    var expdate = new Date();
    expdate.setDate(expdate.getDate() + expDays);
    document.cookie = name + "=" + value + ";expires=" + expdate;
}

//移除cookie
function removeCookie(name) {
    setCookie(name, "", -1);
}